home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / util / misc / Change.lha / Change / source / Include / SDI_defines.h < prev   
C/C++ Source or Header  |  1998-01-10  |  3KB  |  118 lines

  1. #ifndef SDI_DEFINES_H
  2. #define SDI_DEFINES_H
  3.  
  4. /* Includeheader
  5.  
  6.     Name:        SDI_defines
  7.     Versionstring:    $VER: SDI_defines.h 1.25 (08.10.97)
  8.     Author:        SDI
  9.     Distribution:    PD
  10.     Description:    standard defines and macros and version string
  11.  
  12.  1.17  12.06.96 : RETURN_WARN instead of RETURN_ERROR in SDI_ENDCODE
  13.  1.18  06.07.96 : End: PrintFault behind end --> allows selecting output
  14.  1.19  21.08.96 : added __SASC __AMIGADATE__ support
  15.  1.20  24.08.96 : better SAS-C support
  16.  1.21  04.09.96 : changed error with SAS date having the brackets already
  17.  1.22  18.11.96 : converted to english, C++ comments to C ones
  18.  1.23  02.01.97 : corrected some stuff
  19.  1.24  17.03.97 : removed GetChar and other obsolete defines
  20.  1.25  08.10.97 : renamed defines, removed some defines
  21. */
  22.  
  23. #include <exec/types.h>
  24.  
  25. /* ========================= useable defines ============================ */
  26.  
  27. /*
  28.   SDI_ENDCODE        turn on generation of End function
  29.   SDI_ENDCODE_NOCTRLC    use End generation without CTRL_C check
  30.  
  31.   AUTHOR    program author - default is "by SDI"
  32.   DATE        programm creation date - default is automatically created
  33.   DISTRIBUTION    distribution form - default is "(PD) "
  34.   REVISION    revision number - default is "0"
  35.   VERSION    version number - default is "1"
  36. */
  37.  
  38. /* ======================= no need for <stdlib.h> ======================= */
  39.  
  40. extern void exit(int);
  41.  
  42. /* ============================ other macros ============================ */
  43.  
  44. /* <proto/exec.h>, <dos/dos.h> */
  45.  
  46. #define CTRL_C        (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
  47.  
  48. /* ================================= SAS C ============================== */
  49.  
  50. #define TestOS if(DOSBase->dl_lib.lib_Version < DosVersion)    \
  51.              exit(RETURN_FAIL)
  52.  
  53. /* A word about variable DosVersion: In my startup code for MaxonC++ I
  54. include use OpenLibrary("dos.library", DosVersion) instead of standard
  55. OpenLibrary("dos.library",0) call. If no DosVersion is given, this
  56. variable defaults to 33, else you can give the value by creating a global
  57. variable ULONG DosVersion = 37;. The program does not start, when the
  58. required DOS is not available. (Better then others, which crash) */
  59.  
  60. /* ===================== version string and EndCode ===================== */
  61.  
  62.  
  63. #ifdef NAME
  64.   #ifndef AUTHOR
  65.     #define AUTHOR "by SDI"
  66.   #endif
  67.   #ifndef VERSION
  68.     #define VERSION "1"
  69.   #endif
  70.   #ifndef REVISION
  71.     #define REVISION "0"
  72.   #endif
  73.   #ifndef DATE
  74.     #ifdef __MAXON__
  75.       #define DATE __DATE2__
  76.     #elif defined(__SASC)
  77.       #define DATE __AMIGADATE__
  78.     #endif
  79.   #endif
  80.   #ifdef __MAXON__
  81.     #define SDI_DATE "(" DATE ")"
  82.   #elif defined(__SASC)
  83.     #define SDI_DATE DATE
  84.   #endif
  85.  
  86.   #ifndef DISTRIBUTION
  87.     #define DISTRIBUTION "(PD) "
  88.   #endif
  89.   STRPTR version = (STRPTR) "$VER: " NAME " " VERSION "." REVISION " "
  90.   SDI_DATE " " DISTRIBUTION AUTHOR;
  91. #endif /* NAME */
  92.  
  93. #if defined(SDI_ENDCODE) || defined(SDI_ENDCODE_NOCTRLC)
  94.   #ifdef __MAXON__
  95.     #define __inline
  96.     inline
  97.   #endif
  98.     void __inline end(void);
  99.   void End(UBYTE err)
  100.   {
  101.     #ifndef SDI_ENDCODE_NOCTRLC
  102.     if(CTRL_C)
  103.     {
  104.       err = RETURN_WARN;
  105.       SetIoErr(ERROR_BREAK);
  106.     }
  107.     #endif
  108.  
  109.     end();
  110.  
  111.     if(err)        PrintFault(IoErr(), 0);
  112.     exit(err);
  113.   }
  114. #endif /* SDI_ENDCODE && SDI_ENDCODE_NOCTRLC */
  115.  
  116. #endif /* SDI_DEFINES_H */
  117.  
  118.